package com.xmindguoguo.boot.modular.monitor.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.xmindguoguo.boot.common.constant.SessionConstant;
import com.xmindguoguo.boot.common.model.Server;
import com.xmindguoguo.boot.core.BaseController;
import com.xmindguoguo.boot.core.shiro.ShiroKit;

/**
 * 服务器信息监控
 * 
 * @ClassName ServerController
 * @author <a href="892042158@qq.com" target="_blank">于国帅</a>
 * @date 2019年2月16日 上午11:30:47
 *
 */
@Controller
@RequestMapping("/monitorServer")
public class ServerController extends BaseController {
    // 所属子模块名称+当前功能名称
    private String PREFIX = "/monitor/server/";

    @RequestMapping("/toServerInfo")
    public String toServerInfo() throws Exception {
        try {
            // 获取对应的服务信息
            Server server = new Server();
            server.copyTo();
            request.setAttribute("server", server);
        } catch (Throwable e) {
            ShiroKit.setSessionAttr(SessionConstant.SYSTEM_ERROR_INFO, "您的系统不支持功能");
            throw e;
        }
        return PREFIX + "serverInfo";
    }
}
